﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL.Gateway;
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("BE")]
namespace DAL.Membership
{
    public class UsersDAL<T>:IDisposable
    {
        static internal int? Get_iUserId(string sName, string sPassword)
        {
            string GetUserLoginId = "8BE573B6-23B9-4062-9B60-45E35D53719B";
             try
            {
                int? result = null;
                //result = new GenericList<T>().GetAGenelicListOf(
                //    DAL.Gateway.DataAccessGateway.TraerDataTable(GetUserLoginId,sName,sPassword)).Single();
                return result;
            }
            catch(Exception ex)
            {
                throw new Exception("ConnectionsDAL - Create - ",ex);
            }
        }
        internal T GetUserLogin(string sName, string sPassword)
        {
            string GetUserLoginId = "8BE573B6-23B9-4062-9B60-45E35D53719B";
            T result = Activator.CreateInstance<T>();
            try
            {
                if (new GenericList<T>().GetAGenelicListOf(
                    DAL.Gateway.DataAccessGateway.TraerDataTable(GetUserLoginId, sName, sPassword)).Count > 0)
                {
                    result = new GenericList<T>().GetAGenelicListOf(
                        DAL.Gateway.DataAccessGateway.TraerDataTable(GetUserLoginId, sName, sPassword)).Single();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("ConnectionsDAL - Create - ", ex);
            }
            return result;
        }
        public void Dispose()
        {
        }
    }
}
